
package com.rt.schedulenew.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rt.schedulebase.dto.DictScheduleHospitalDto;
import com.rt.schedulebase.entity.DictScheduleHospital;
import com.rt.schedulebase.mapper.DictScheduleHospitalMapper;
import com.rt.schedulenew.service.IDictScheduleHospitalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class DictScheduleHospitalServiceImpl extends ServiceImpl<DictScheduleHospitalMapper, DictScheduleHospital> implements IDictScheduleHospitalService {
    @Override
    public DictScheduleHospital getInfo(DictScheduleHospitalDto dto) {
        QueryWrapper<DictScheduleHospital> qw = new QueryWrapper<>();
        Map<String, Object> map = new HashMap<>();
        map.put("EXAM_CLASS", dto.getExamClass());
        map.put("QUEUE_NAME", dto.getQueueName());
        map.put("HOSPITAL_CODE", dto.getHospitalCode());
        qw.allEq(map);
        return baseMapper.selectOne(qw);
    }


    @Override
    public List<DictScheduleHospital> getList(DictScheduleHospitalDto dto) {
        QueryWrapper<DictScheduleHospital> qw = new QueryWrapper<>();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("EXAM_CLASS", dto.getExamClass());
        map.put("QUEUE_NAME", dto.getQueueName());
        map.put("HOSPITAL_CODE", dto.getHospitalCode());
        qw.allEq(map, false);
        List<DictScheduleHospital> list = baseMapper.selectList(qw);
        return list;
    }

    @Override
    public List<DictScheduleHospital> getListAll() {
        return baseMapper.selectList(null);
    }
}
